package libra.controller;

import org.springframework.stereotype.Component;

import libra.model.JsonResult;

@Component
public class ConsumerFeignFallBack implements ConsumerFeignService {
	//该接口不存在Hystrix服务降级
	@Override
	public Object create(String serial) { return "ConsumerFeignFallBack_create"; }
	//该接口不存在Hystrix服务降级
	@Override
	public Object find(Integer id) { return "ConsumerFeignFallBack_find"; }
	//该接口不存在Hystrix服务降级
	@Override
	public Object list() { return "ConsumerFeignFallBack_list"; }
	//该接口不存在Hystrix服务降级
	@Override
	public Object Ok() { return "ConsumerFeignFallBack_Ok"; }
	
	
	/* 该接口在Provider端已做服务降级处理 */
	@Override
	public Object TimeOutWithHystrix(Boolean flag) { return "ConsumerFeignFallBack_TimeOutWithHystrix"; }
	/* 该接口在Provider端已做服务降级处理 */
	@Override
	public Object ErrorWithHystrix(Boolean flag) { return "ConsumerFeignFallBack_ErrorWithHystrix"; }
	
	
	/** 针对于客户端的Feign调用服务降级，编写统一的默认fallBack处理 */
	@Override
	public Object TimeOut(Boolean flag) throws Exception {
		return new JsonResult<String>(0, "ConsumerFeignFallBack客户端Feign统一调用，TimeOut失败", null);
	}
	@Override
	public Object Error(Boolean flag) throws Exception {
		return new JsonResult<String>(0, "ConsumerFeignFallBack客户端Feign统一调用，Error失败", null);
	}
}
